<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			
			<li class="active"><a >视频添加</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('Video/add_post')}" enctype="multipart/form-data">
			<fieldset>				
				<div class="form-group">
					<label for="input-status" class="col-sm-2 control-label"><span class="form-required">*</span>视频状态</label>
					<div class="col-md-6 col-sm-10">
						<label class="radio-inline"><input type="radio" name="status" value="1" checked>通过</label>
						<label class="radio-inline"><input type="radio" name="status" value="2" >不通过</label>
					</div>
				</div>
				
				<div class="form-group">
					<label for="input-isdel" class="col-sm-2 control-label"><span class="form-required">*</span>上下架状态</label>
					<div class="col-md-6 col-sm-10">
						<label class="radio-inline"><input type="radio" name="isdel" value="0" checked>上架</label>
						<label class="radio-inline"><input type="radio" name="isdel" value="1" >下架</label>
					</div>
				</div>
				
				
				<div class="form-group">
					<label for="input-owner" class="col-sm-2 control-label"><span class="form-required">*</span>所有者</label>
					<div class="col-md-6 col-sm-10">
						<label class="radio-inline"><input type="radio" name="owner" value="0" checked>管理员</label>
						<label class="radio-inline"><input type="radio" name="owner" value="1" >用户</label>
					</div>
				</div>
				
				<div class="form-group" id="owner_uid" style="display: none;">
					<label for="input-owner_uid" class="col-sm-2 control-label"><span class="form-required">*</span>视频所有者用户</label>
					<div class="col-md-6 col-sm-10">
						<input type="text"class="form-control" id="input-owner_uid"  name="owner_uid" onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');">
						<p class="help-block">请填写用户id</p>
					</div>
				</div>
				
				<div class="form-group" >
					<label for="input-title" class="col-sm-2 control-label"><span class="form-required">*</span>视频标题</label>
					<div class="col-md-6 col-sm-10">
						<input type="text" class="form-control" id="input-title"  name="title" value="">
					</div>
				</div>




				<div class="form-group">
					<label for="input-user_login" class="col-sm-2 control-label"><span class="form-required">*</span>图片</label>
					<div class="col-md-6 col-sm-10">
						<input type="hidden" name="thumb" id="thumbewm" value="">
						<a href="javascript:uploadOneImage('图片上传','#thumbewm');">
							<img src="__TMPL__/public/assets/images/default-thumbnail.png" id="thumbewm-preview" style="cursor: pointer;max-width:150px;max-height:150px;"/>
						</a>
						<input type="button" class="btn btn-sm btn-cancel-thumbewm" value="取消图片">
					</div>
				</div>
				
				<div class="form-group">
					<label for="input-video_upload_type" class="col-sm-2 control-label"><span class="form-required">*</span>视频上传型式</label>
					<div class="col-md-6 col-sm-10">
						<label class="radio-inline"><input type="radio" name="video_upload_type" value="0" checked>视频链接</label>
						<label class="radio-inline"><input type="radio" name="video_upload_type" value="1" >视频文件</label>
					</div>
				</div>
				
				<div class="form-group video_url_area" >
					<label for="input-href" class="col-sm-2 control-label"><span class="form-required">*</span>视频链接</label>
					<div class="col-md-6 col-sm-10">
						<input type="text"class="form-control" id="input-href"  name="href" value=""><p class="help-block">以http://或https://开头</p>
					</div>
				</div>
				
				<div class="form-group video_url_area" >
					<label for="input-href_w" class="col-sm-2 control-label"><span class="form-required">*</span>水印视频链接</label>
					<div class="col-md-6 col-sm-10">
						<input type="text"class="form-control" id="input-href_w"  name="href_w" value=""><p class="help-block">以http://或https://开头</p>
					</div>
				</div>

				<div class="form-group upload_video_area" style="display: none;">
					<label for="input-user_login" class="col-sm-2 control-label">上传视频</label>
					<div class="col-md-6 col-sm-10">
						<input type="file" name="file" />
					</div>
				</div>
				
				<div class="form-group upload_video_area" style="display: none;">
					<label for="input-user_login" class="col-sm-2 control-label">上传水印视频</label>
					<div class="col-md-6 col-sm-10">
						<input type="file" name="file_w" />
					</div>
				</div>


			</fieldset>
			
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
					<a class="btn btn-default" href="{:url('Video/passindex')}">{:lang('BACK')}</a>
				</div>
			</div>
			
		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
	<script type="text/javascript">
		$(function(){

			$("input[name='video_upload_type']").click(function(){
				var val=$("input[name='video_upload_type']:checked").val();
				//console.log(val);
				if(val==0){
					$(".video_url_area").show();
					$(".upload_video_area").hide();
				}else{
					$(".video_url_area").hide();
					$(".upload_video_area").show();
					$("input[name='href']").val('');
				}
			});

			$("input[name='owner']").on("click",function(){
				var val=$(this).val();
				if(val==1){ //所有者为用户
					$("#owner_uid").show();
				}else{
					$("#owner_uid").hide();
				}
			});
			
			
			$('.btn-cancel-thumbewm').click(function () {
				$('#thumbewm-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
				$('#thumbewm').val('');
			});
			

		});
	</script>
</body>
</html>